﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ASCII_operations
{
    class Program
    {

        static List<int[]> FromTo = new List<int[]>();

        static ASCII MakeForestMap(string dir, ASCII LandUseMap)
        {
            //Forest map
           ASCII ForestMap = LandUseMap;
           for(int c=0;c<20;c++)
           {
               if (c == 1) ForestMap.ReplaceValues(c, Gaussian.CappedRandom, 140, 40, 70, 150);
               else if (c == 2) ForestMap.ReplaceValues(c, Gaussian.CappedRandom, 50, 30, 15, 70);
               else if (c == 3) ForestMap.ReplaceValues(c, Gaussian.CappedRandom, 15, 5, 15, 30);
               else ForestMap.ReplaceValues(c, 0);
           }
           
           return ForestMap;
        }
        static ASCII MakeLandUseMap(string dir, string fn)
        {
            ASCII a = new ASCII(dir + fn);


            a.ReplaceValues(65, 2);

            return a;
            int c = 100;
            for (int m = 0; m < 100; m++)
            {
                a.ReplaceValues(m, m + c);
            }
            
            for (int m = c; m < c + 100; m++)
            {
                if (m == c) a.ReplaceValues(m, 0);
                else if (m == 25 + c) a.ReplaceValues(m, 2);
                else if (m == 28 + c) a.ReplaceValues(m, 3);
                else if (m == 65 + c) a.ReplaceValues(m, 3);
                else a.ReplaceValues(m, 1);
            }
             
            

            return a;
        }
        static void Main(string[] args)
        {
            string dir = "C:\\Users\\adebruij\\Desktop\\CO2Fix landscape Conversion Script\\input";

            //string fn = "InitialLandUse.asc";

            //ASCII LandUseMap = MakeLandUseMap(dir,fn);

            ASCII LandUseMap = new ASCII(dir + "\\malinau2000.asc");

            //LandUseMap.Write(dir + "InitialLandUse2.asc");

            ASCII ForestMap = MakeForestMap(dir, LandUseMap);

            ForestMap.Write(dir + "\\ForestBiomass.asc");
           

        }
    }
}
